<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app"></div>
    <script src="./vue.js"></script>
    <script>
      /*
        1. 如果想要操作对象，最早可以在created中操作
        2. 如果想要操作DOM，最早可以在mounted中操作
      */
      new Vue({
        el: "#app",
        template: `
            <div>
                hello  
                <b id="b1">jack</b>
            </div>
            `,
        data: {},
        created() {
          console.log("created");
          console.log(document.getElementById("b1"));
        },
        beforeMount() {
          // 挂载前
          console.log("beforeMount");
          console.log(document.getElementById("b1"));
        },
        mounted() {
          // 挂载后
          console.log("mounted");
          console.log(document.getElementById("b1"));
        },
        methods: {},
      });
    </script>
  </body>
</html>
